package com.jn.hilt.module;

import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.OvershootInterpolator;
import android.view.animation.TranslateAnimation;

import com.jn.hilt.qualifier.AppQualifier;

import dagger.Module;
import dagger.Provides;
import dagger.hilt.InstallIn;
import dagger.hilt.android.components.ActivityComponent;
import dagger.hilt.android.scopes.ActivityScoped;

@Module
@InstallIn(ActivityComponent.class)
public class AnimationModule {
    @ActivityScoped
    @AppQualifier.LinearAnim
    @Provides
    public TranslateAnimation provideLinearAnim() {
        TranslateAnimation animation = new TranslateAnimation(0, 400, 0, 0);
        animation.setDuration(500);
        animation.setRepeatCount(3);
        animation.setRepeatMode(Animation.REVERSE);
        animation.setInterpolator(new LinearInterpolator());
        return animation;
    }

    @AppQualifier.OvershootAnim
    @Provides
    public TranslateAnimation provideOvershootAnim() {
        TranslateAnimation animation = new TranslateAnimation(0, 0, 0, 1000);
        animation.setDuration(800);
        animation.setInterpolator(new OvershootInterpolator());
        return animation;
    }
}
